/*
 * Copyright 2013 Agustina Martinez-Garcia

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package uk.ljmu.mulgaraifz.model;

import java.util.ArrayList;
import java.util.List;

public class CollectionElement {
    private boolean displayed;
    private String collectionId;
    private String collectionTitle;
    private boolean rootCollection;
    private List<String> immediateChildren;
    private List<String> immediateParents;
    
    /**
     * @param displayed the displayed to set
     */
    public void setDisplayed(boolean displayed) {
	this.displayed = displayed;
    }
    /**
     * @return the displayed
     */
    public boolean isDisplayed() {
	return displayed;
    }
    /**
     * @return the collectionId
     */
    public String getCollectionId() {
        return collectionId;
    }
    /**
     * @param collectionId the collectionId to set
     */
    public void setCollectionId(String collectionId) {
        this.collectionId = collectionId;
    }
    /**
     * @return the collectionTitle
     */
    public String getCollectionTitle() {
        return collectionTitle;
    }
    /**
     * @param collectionTitle the collectionTitle to set
     */
    public void setCollectionTitle(String collectionTitle) {
        this.collectionTitle = collectionTitle;
    }
    /**
     * @return the rootCollection
     */
    public boolean isRootCollection() {
        return rootCollection;
    }
    /**
     * @param rootCollection the rootCollection to set
     */
    public void setRootCollection(boolean rootCollection) {
        this.rootCollection = rootCollection;
    }
    /**
     * @return the immediateChildren
     */
    public List<String> getImmediateChildren() {
        return immediateChildren;
    }
    /**
     * @param immediateChildren the immediateChildren to set
     */
    public void setImmediateChildren(List<String> immediateChildren) {
        this.immediateChildren = immediateChildren;
    }
    /**
     * @return the immediateParents
     */
    public List<String> getImmediateParents() {
        return immediateParents;
    }
    /**
     * @param immediateParents the immediateParents to set
     */
    public void setImmediateParents(List<String> immediateParents) {
        this.immediateParents = immediateParents;
    }
    
    public CollectionElement() {
	this.immediateChildren = new ArrayList<String>();
	this.immediateParents = new ArrayList<String>();
	this.collectionId = "";
	this.collectionTitle = "";
	this.displayed = false;
    }
    //Static Methods
    public static CollectionElement findElement(String identifier, List<CollectionElement> elementList) {
	for (CollectionElement elem : elementList) {
	    if (elem.getCollectionId().equals(identifier))
		return elem;
	}
	//Element not found
	return null;
    }
}
